<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>限时特惠 - 超值好物</title>
		<style>
			* {
				margin: 0;
				padding: 0;
				box-sizing: border-box;
			}

			body {
				font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
				line-height: 1.6;
				color: #333;
				overflow-x: hidden;
			}

			/* 导航栏 */
			nav {
				position: fixed;
				top: 0;
				width: 100%;
				background: rgba(255, 255, 255, 0.95);
				backdrop-filter: blur(10px);
				z-index: 1000;
				padding: 1rem 2rem;
				box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
			}

			.nav-container {
				max-width: 1200px;
				margin: 0 auto;
				display: flex;
				justify-content: space-between;
				align-items: center;
			}

			.cart-icon {
				position: relative;
				cursor: pointer;
				font-size: 1.5rem;
			}

			.cart-count {
				position: absolute;
				top: -8px;
				right: -8px;
				background: #ff4757;
				color: white;
				border-radius: 50%;
				width: 20px;
				height: 20px;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 0.8rem;
			}

			/* 英雄区域 */
			.hero {
				height: 100vh;
				position: relative;
				display: flex;
				align-items: center;
				justify-content: center;
				background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
				overflow: hidden;
			}

			.hero-content {
				text-align: center;
				z-index: 2;
				color: white;
			}

			.glitch-text {
				font-size: 4rem;
				font-weight: bold;
				margin-bottom: 1rem;
				animation: glitch 2s infinite;
			}

			@keyframes glitch {

				0%,
				100% {
					text-shadow: 2px 2px 0 red, -2px -2px 0 blue;
				}

				25% {
					text-shadow: -2px 2px 0 red, 2px -2px 0 blue;
				}

				50% {
					text-shadow: 2px -2px 0 red, -2px 2px 0 blue;
				}

				75% {
					text-shadow: -2px -2px 0 red, 2px 2px 0 blue;
				}
			}

			.hero-subtitle {
				font-size: 1.5rem;
				margin-bottom: 2rem;
			}

			.countdown {
				font-size: 2rem;
				margin-bottom: 2rem;
			}

			.countdown span {
				background: rgba(255, 255, 255, 0.2);
				padding: 0.5rem 1rem;
				border-radius: 5px;
				margin: 0 0.5rem;
			}

			.cta-button {
				background: #ff4757;
				color: white;
				border: none;
				padding: 1rem 2rem;
				font-size: 1.2rem;
				border-radius: 50px;
				cursor: pointer;
				transition: transform 0.3s ease, box-shadow 0.3s ease;
			}

			.cta-button:hover {
				transform: translateY(-2px);
				box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
			}

			.hero-background {
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				z-index: 1;
			}

			#particle-canvas {
				width: 100%;
				height: 100%;
			}

			/* 产品展示区 */
			.products {
				padding: 4rem 2rem;
				max-width: 1200px;
				margin: 0 auto;
			}

			.section-title {
				text-align: center;
				font-size: 2.5rem;
				margin-bottom: 3rem;
			}

			.product-grid {
				display: grid;
				grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
				gap: 2rem;
			}

			.product-card {
				background: white;
				border-radius: 10px;
				overflow: hidden;
				box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
				transition: transform 0.3s ease;
				animation: float 3s ease-in-out infinite;
			}

			@keyframes float {
				0% {
					transform: translateY(0px);
				}

				50% {
					transform: translateY(-10px);
				}

				100% {
					transform: translateY(0px);
				}
			}

			.product-card:hover {
				transform: translateY(-10px);
				box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
			}

			.product-image {
				position: relative;
				height: 200px;
				overflow: hidden;
			}

			.product-image img {
				width: 100%;
				height: 100%;
				object-fit: cover;
			}

			.product-badge {
				position: absolute;
				top: 10px;
				right: 10px;
				background: #ff4757;
				color: white;
				padding: 0.3rem 0.8rem;
				border-radius: 20px;
				font-size: 0.9rem;
			}

			.product-info {
				padding: 1.5rem;
			}

			.product-info h3 {
				margin-bottom: 1rem;
				font-size: 1.2rem;
			}

			.price {
				display: flex;
				align-items: center;
				gap: 1rem;
				margin-bottom: 1rem;
			}

			.original-price {
				text-decoration: line-through;
				color: #999;
			}

			.sale-price {
				color: #ff4757;
				font-size: 1.5rem;
				font-weight: bold;
			}

			.product-stats {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-bottom: 1rem;
			}

			.sold-count {
				color: #666;
			}

			.rating {
				color: #ffd700;
			}

			.add-to-cart {
				width: 100%;
				padding: 0.8rem;
				background: #667eea;
				color: white;
				border: none;
				border-radius: 5px;
				cursor: pointer;
				transition: background 0.3s ease;
			}

			.add-to-cart:hover {
				background: #5a67d8;
			}

			/* 飞入动画 */
			.flying-item {
				position: fixed;
				width: 30px;
				height: 30px;
				background: #667eea;
				border-radius: 50%;
				pointer-events: none;
				transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
				z-index: 1000;
			}

			/* Toast提示 */
			.toast {
				position: fixed;
				bottom: 20px;
				left: 50%;
				transform: translateX(-50%);
				background: rgba(0, 0, 0, 0.8);
				color: white;
				padding: 1rem 2rem;
				border-radius: 5px;
				opacity: 0;
				transition: opacity 0.3s ease;
				z-index: 1000;
			}

			.toast.show {
				opacity: 1;
			}

			/* 响应式设计 */
			@media (max-width: 768px) {
				.glitch-text {
					font-size: 2.5rem;
				}

				.hero-subtitle {
					font-size: 1.2rem;
				}

				.countdown {
					font-size: 1.5rem;
				}

				.product-grid {
					grid-template-columns: repeat(2, 1fr);
				}
			}

			@media (max-width: 480px) {
				.glitch-text {
					font-size: 2rem;
				}

				.hero-subtitle {
					font-size: 1rem;
				}

				.countdown {
					font-size: 1.2rem;
				}

				.product-grid {
					grid-template-columns: 1fr;
				}
			}
		</style>
	</head>
	<body>
		<!-- 导航栏 -->
		<nav>
			<div class="nav-container">
				<div class="logo">超值好物</div>
				<div class="cart-icon" onclick="showCart()">
					🛒
					<span class="cart-count" id="cartCount">0</span>
				</div>
			</div>
		</nav>

		<!-- 英雄区域 -->
		<section class="hero">
			<div class="hero-content">
				<h1 class="glitch-text">限时特惠</h1>
				<p class="hero-subtitle">错过再等一年</p>
				<div class="countdown">
					<span id="days">00</span>天
					<span id="hours">00</span>时
					<span id="minutes">00</span>分
					<span id="seconds">00</span>秒
				</div>
				<button class="cta-button" onclick="scrollToProducts()">
					立即抢购
				</button>
			</div>
			<div class="hero-background">
				<canvas id="particle-canvas"></canvas>
			</div>
		</section>

		<!-- 产品展示区 -->
		<section class="products">
			<h2 class="section-title">热卖商品</h2>
			<div class="product-grid">
				<!-- 产品卡片1 -->
				<div class="product-card" data-product-id="1">
					<div class="product-image">
						<img src="https://picsum.photos/seed/product1/400/300.jpg" alt="产品图片">
						<div class="product-badge">热卖</div>
					</div>
					<div class="product-info">
						<h3>智能手表 Pro</h3>
						<div class="price">
							<span class="original-price">¥2999</span>
							<span class="sale-price">¥1999</span>
						</div>
						<div class="product-stats">
							<span class="sold-count">已售 9999+</span>
							<div class="rating">★★★★★</div>
						</div>
					</div>
					<button class="add-to-cart" onclick="addToCart(1)">
						加入购物车
					</button>
				</div>

				<!-- 产品卡片2 -->
				<div class="product-card" data-product-id="2">
					<div class="product-image">
						<img src="https://picsum.photos/seed/product2/400/300.jpg" alt="产品图片">
						<div class="product-badge">新品</div>
					</div>
					<div class="product-info">
						<h3>无线耳机 Max</h3>
						<div class="price">
							<span class="original-price">¥1599</span>
							<span class="sale-price">¥999</span>
						</div>
						<div class="product-stats">
							<span class="sold-count">已售 5000+</span>
							<div class="rating">★★★★☆</div>
						</div>
					</div>
					<button class="add-to-cart" onclick="addToCart(2)">
						加入购物车
					</button>
				</div>

				<!-- 产品卡片3 -->
				<div class="product-card" data-product-id="3">
					<div class="product-image">
						<img src="https://picsum.photos/seed/product3/400/300.jpg" alt="产品图片">
						<div class="product-badge">限量</div>
					</div>
					<div class="product-info">
						<h3>机械键盘 RGB</h3>
						<div class="price">
							<span class="original-price">¥899</span>
							<span class="sale-price">¥599</span>
						</div>
						<div class="product-stats">
							<span class="sold-count">已售 3000+</span>
							<div class="rating">★★★★★</div>
						</div>
					</div>
					<button class="add-to-cart" onclick="addToCart(3)">
						加入购物车
					</button>
				</div>
			</div>
		</section>

		<!-- Toast提示 -->
		<div class="toast" id="toast"></div>

		<script>
			// 粒子动画
			const canvas = document.getElementById('particle-canvas');
			const ctx = canvas.getContext('2d');
			canvas.width = window.innerWidth;
			canvas.height = window.innerHeight;

			const particles = [];
			const particleCount = 100;

			class Particle {
				constructor() {
					this.x = Math.random() * canvas.width;
					this.y = Math.random() * canvas.height;
					this.size = Math.random() * 3 + 1;
					this.speedX = Math.random() * 3 - 1.5;
					this.speedY = Math.random() * 3 - 1.5;
				}

				update() {
					this.x += this.speedX;
					this.y += this.speedY;

					if (this.x > canvas.width || this.x < 0) {
						this.speedX = -this.speedX;
					}
					if (this.y > canvas.height || this.y < 0) {
						this.speedY = -this.speedY;
					}
				}

				draw() {
					ctx.fillStyle = 'rgba(255, 255, 255, 0.5)';
					ctx.beginPath();
					ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
					ctx.fill();
				}
			}

			// 初始化粒子
			for (let i = 0; i < particleCount; i++) {
				particles.push(new Particle());
			}

			// 动画循环
			function animateParticles() {
				ctx.clearRect(0, 0, canvas.width, canvas.height);
				particles.forEach(particle => {
					particle.update();
					particle.draw();
				});
				requestAnimationFrame(animateParticles);
			}

			animateParticles();

			// 倒计时功能
			function updateCountdown() {
				const endDate = new Date('2024-12-31T23:59:59').getTime();
				const now = new Date().getTime();
				const distance = endDate - now;

				const days = Math.floor(distance / (1000 * 60 * 60 * 24));
				const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
				const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
				const seconds = Math.floor((distance % (1000 * 60)) / 1000);

				document.getElementById('days').textContent = String(days).padStart(2, '0');
				document.getElementById('hours').textContent = String(hours).padStart(2, '0');
				document.getElementById('minutes').textContent = String(minutes).padStart(2, '0');
				document.getElementById('seconds').textContent = String(seconds).padStart(2, '0');
			}

			setInterval(updateCountdown, 1000);
			updateCountdown(); // 立即执行一次

			// 平滑滚动到产品区
			function scrollToProducts() {
				document.querySelector('.products').scrollIntoView({
					behavior: 'smooth'
				});
			}

			// 视差滚动效果
			window.addEventListener('scroll', () => {
				const scrolled = window.pageYOffset;
				const parallax = document.querySelector('.hero-background');
				parallax.style.transform = `translateY(${scrolled * 0.5}px)`;
			});

			// 购物车功能
			let cartCount = 0;

			function addToCart(productId) {
				const button = event.target;
				const cartIcon = document.querySelector('.cart-icon');

				// 创建飞入动画
				const flyingItem = document.createElement('div');
				flyingItem.className = 'flying-item';
				document.body.appendChild(flyingItem);

				// 获取按钮和购物车的位置
				const buttonRect = button.getBoundingClientRect();
				const cartRect = cartIcon.getBoundingClientRect();

				// 设置动画起始位置
				flyingItem.style.left = buttonRect.left + buttonRect.width / 2 + 'px';
				flyingItem.style.top = buttonRect.top + buttonRect.height / 2 + 'px';

				// 触发动画
				setTimeout(() => {
					flyingItem.style.left = cartRect.left + cartRect.width / 2 + 'px';
					flyingItem.style.top = cartRect.top + cartRect.height / 2 + 'px';
					flyingItem.style.opacity = '0';
				}, 10);

				// 动画结束后移除元素并更新购物车
				setTimeout(() => {
					flyingItem.remove();
					cartCount++;
					document.getElementById('cartCount').textContent = cartCount;
					showToast('已加入购物车！');
				}, 1000);
			}

			// 显示购物车
			function showCart() {
				showToast(`购物车中有 ${cartCount} 件商品`);
			}

			// Toast提示功能
			function showToast(message) {
				const toast = document.getElementById('toast');
				toast.textContent = message;
				toast.classList.add('show');

				setTimeout(() => {
					toast.classList.remove('show');
				}, 3000);
			}

			// 窗口大小改变时重新设置canvas大小
			window.addEventListener('resize', () => {
				canvas.width = window.innerWidth;
				canvas.height = window.innerHeight;
			});
		</script>
	</body>
</html>